package com.quectel.core.module.forum.dto.mongo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author zhangheng
 * @email nolan.zhang@quectel.com
 * @date 2023/5/8 15:52
 * @description 帖子
 */
@Data
@Schema
public class ForumPostDto implements Serializable {
    /**
     * id
     */
    @Schema(description = "id")
    private Long id;

    /**
     * 租户id
     */
    @Schema(description = "租户id")
    private Long tenantId;

    /**
     * 城市code
     */
    @Schema(description = "城市id")
    private String cityCode;

    /**
     * 可见小区id
     */
    @Schema(description = "可见小区id")
    private Long villageId;

    /**
     * 作者id
     */
    @Schema(description = "作者id")
    private Long authorId;

    /**
     * 所属类别
     */
    @Schema(description = "所属类别")
    private Byte type;

    /**
     * 绑定话题
     */
    @Schema(description = "绑定话题")
    private List<Long> topics;

    /**
     * 内容
     */
    @Schema(description = "内容")
    private String content;
    /**
     * 图片列表
     */
    @Schema(description = "图片列表")
    private List<String> imageUrls;

    /**
     * 点赞数量
     */
    @Schema(description = "点赞数量")
    private Integer likeCount = 0;

    /**
     * 评论数量
     */
    @Schema(description = "评论数量")
    private Integer commentCount = 0;

    /**
     * 分享数量
     */
    @Schema(description = "分享数量")
    private Integer shareCount = 0;


    /**
     * 置顶标记
     */
    @Schema(description = "置顶标记,1置顶0非置顶")
    private Byte topFlag;


    /**
     * 是否其他小区可见 1可见0非可见
     */
    @Schema(description = "是否其他小区可见 1可见0非可见")
    private Byte visibleFlag = 1;

    /**
     * 删除标识
     */
    @Schema(description = "删除标识")
    private Byte deletedFlag = 0;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private Date publishTime;

    /**
     * 编辑时间
     */
    @Schema(description = "编辑时间")
    private Date editTime;


    /************非数据库字段 start ************/

    /**
     * 小区名称
     */
    @Schema(description = "昵称")
    private String villageName;

    /**
     * 置顶标记
     */
    @Schema(description = "昵称")
    private String nickName;


    /**
     * 头像
     */
    @Schema(description = "头像")
    private String headImg;

    /**
     * 本人发帖标记
     */
    @Schema(description = "本人发帖标记,1本人发帖0,非本人发帖")
    private Byte authorFlag;

    /**
     * 点赞标记
     */
    @Schema(description = "点赞标记,1点赞0未点赞")
    private Byte likeFlag;


    /**
     * 话题名称列表
     */
    @Schema(description = "话题名称列表")
    private List<String> topicNames;

    /**
     * 是否选中
     */
    @Schema(description = "是否选中")
    private boolean  checked =false;

    /************非数据库字段 end   ************/

    public void setLikeCount(Integer likeCount) {
        if(likeCount < 0 ){
            this.likeCount = 0;
        }else{
            this.likeCount = likeCount;
        }
    }
    public void setCommentCount(Integer commentCount) {
        if(commentCount < 0 ){
            this.commentCount = 0;
        }else{
            this.commentCount = commentCount;
        }
    }
    public void setShareCount(Integer shareCount) {
        if(shareCount < 0 ){
            this.shareCount = 0;
        }else{
            this.shareCount = shareCount;
        }
    }
}
